package com.wh.maker.generator.file;


import freemarker.template.TemplateException;

import java.io.File;
import java.io.IOException;

/**
 * 核心生成器
 */
public class FileGenerator {



    public static void doGenerate(Object model) throws IOException, TemplateException
    {
        //整个项目的根路径
        String projectPath = System.getProperty("user.dir");
        //拿到父目录
        File parentFile = new File(projectPath).getParentFile();

        //输入路径
        String inputPath = new File(parentFile,"wh-generate-demo-projects/acm-template").getAbsolutePath();
        String outputPath = projectPath;

        //生成静态文件
        StaticFileGenerator.copyFilesByHutool(inputPath, outputPath);

        //生成动态文件
        String inputPath2 = projectPath + File.separator +"src/main/resources/templates/MainTemplate.java.ftl";
        String outputPath2 = outputPath + File.separator +"acm-template/src/com/yupi/acm/MainTemplate.java";

        DynamicFileGenerator.doGenerate(inputPath2, outputPath2, model);
    }

}
